package com.dcbeida.model;

import com.dcbeida.MyApplication;
import com.dcbeida.utils.GenApiHashUrl;
import com.dcbeida.utils.JsonGet;

import dc.medicine.com.okhttplib.OkHttpUtils;
import dc.medicine.com.okhttplib.callback.AbsCallback;

/**
 * Created by hp on 2016/7/27.
 */
public class FeaturesModel {

    private static FeaturesModel mModel;
    private FeaturesModel(){

    }

    public static FeaturesModel newInstance() {
        if(mModel==null){
            return new FeaturesModel();
        }else {
            return mModel;
        }
    }

    /**
     *
     * devicetoken:"xxxxxxx—sdfsdf";//设备识别码
     * devicemodule:"iPhone6s",//设备型号及相关规格说明
     * devicetype:1,//1 Iphone，2 Android ，3 WinPhone 9 其它
     * userid:12,//此处将用户与设备绑定在一起
     * shopid:234,//店铺ID，可选。
     *
     * @param mAbsCallback
     */
   public   void bindDevicetoken(String devicetoken,AbsCallback mAbsCallback){
       OkHttpUtils.getInstance().post(GenApiHashUrl.apiUrl).tag(this)
               .paramsApp("service","binddevicetoken")
               .paramsApp("params",new JsonGet().putopt("devicetoken",devicetoken)
                       .putopt("devicemodule", MyApplication.DUID)
                       .putopt("devicetype", 2)
                       .putopt("uid", MyApplication.user.getUid())
                       .putopt("shopid", MyApplication.user.getShopid())
                       .tostring()).execute(mAbsCallback);
   }

    public  void getCancel(){
        OkHttpUtils.getInstance().cancelTag(this);
    }
}
